package app

import (
	"strconv"

	"sieve_admin_server_userpass/lib/config"
	"sieve_admin_server_userpass/pkg/im3/event/cli"
)

var (
	// fServer = config.String("im.server", "im.manyji.net:9999", "im server")
	fServer = config.String("im.server", "im.manyji.net:9998", "im server")
	fAppId  = config.Int("im.app.id", 0, "app id")
	fSecret = config.String("im.app.secret", "", "app secret")
)

func Init(server string, appid int, secret string) {
	*fServer = server
	*fAppId = appid
	*fSecret = secret
	setEvCli()
}

func Server() string {
	return *fServer
}

func AppId() int {
	return *fAppId
}

func Secret() string {
	return *fSecret
}

func init() { setEvCli() }

func setEvCli() {
	cli.Name = "app-" + strconv.Itoa(AppId())
	cli.Pwd = Secret()
}
